package com.zgm.ch03._4_10;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;

public class SimpleBean {

	private int someInt;
	private SimpleBean nestedSimpleBean;
	
	public static void main(String[] args){
		BeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource("/META-INF/spring/ch03/_4_10/_4_10-context.xml"));
		SimpleBean target1 = (SimpleBean) beanFactory.getBean("target1");
		SimpleBean target2 = (SimpleBean) beanFactory.getBean("target2");
		SimpleBean target3 = (SimpleBean) beanFactory.getBean("target3");
		
		System.out.println("target1:" + target1);
		System.out.println("target2:" + target2);
		System.out.println("target3:" + target3);
	}
	
	@Override
	public String toString(){
		final StringBuilder sb = new StringBuilder();
		sb.append("SimpleBean");
		sb.append("{SomeInt=").append(someInt);
		sb.append(", nestedSimpleBean=").append(nestedSimpleBean);
		sb.append("}");
		
		return sb.toString();
		
	}
	
	public void setSomeInt(int someInt) {
		this.someInt = someInt;
	}
	public void setNestedSimpleBean(SimpleBean nestedSimpleBean) {
		this.nestedSimpleBean = nestedSimpleBean;
	}
	
	
}
